/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package xmtTest;

import compareTest.*;
import epam_java.jsontest.UserTest;
import epam_java.telephone.users.UserDaoImpl;
import epam_java.telephone.users.AdminUser;
import epam_java.telephone.users.SubscriberUser;
import java.io.IOException;
import java.sql.SQLException;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.logging.Level;
import java.util.logging.Logger;
import javax.xml.parsers.ParserConfigurationException;
import org.xml.sax.SAXException;
import xmtTest.XMLWriter;

/**
 *
 * @author 1
 */
public class XMLTest {
        public static void main(String[] args) throws SQLException, InterruptedException {
            Compare comp=new Compare();
            comp.buildUsers();
            comp.buildUserId();
            comp.buildLogins();
            Collections.sort(comp.getUserId(),new ComparatorId<Integer>(comp.getUsers()));
             Collections.sort(comp.getLogins(),new ComparatorName<Integer>(comp.getUsers()));
             System.out.println(Arrays.deepToString(comp.getUserId().toArray()));
             System.out.println(Arrays.deepToString(comp.getLogins().toArray()));
             System.out.println(comp.getUsers().get(0).equals(comp.getUsers().get(4)));
             System.out.println(comp.getUsers().get(0).equals(comp.getUsers().get(3)));
             System.out.println("count of equals object=" +comp.getCountequalsUser() );
//            UserDaoImpl userDao= new UserDaoImpl();
//            SubscriberUser admin=new SubscriberUser(1, "Jora","Namchuk", "1111");
//            userDao.createSubscriberUser(admin);
//            admin.setLogin("AAAAAAAAAAAA");
//            userDao.refreshUser(admin);
            // xml parser 
//        try {
//          ArrayList<UserTest> users= XMLParser.parse("user_xml.xml");
//       //     ArrayList<UserTest> users= XMLParser.parse("writtenUsers.xml");
//           XMLWriter writer=new XMLWriter("writtenJoraXML.xml", users);
//           writer.writeXML();
//            for (int i = 0; i < users.size(); i++) {
//                System.out.println(""+users.toString());
//
//            }
//        } catch (Exception ex){
//           ex.printStackTrace();
//        }
    }
}
